package com.yyp.dao.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yyp.bean.ManagerInfo;
import com.yyp.dao.BaseDao;
import com.yyp.dao.ManagerInfoDao;

@Service
@Transactional
public class ManagerInfoDaoImpl implements ManagerInfoDao {
	@Resource
	BaseDao baseDaoImpl;

	public void delete(Serializable names) {
		baseDaoImpl.delete(ManagerInfo.class, this.find((String)names).getId());
	}
	public void delete(Integer id) {
		baseDaoImpl.delete(ManagerInfo.class,id);
	}

	public ManagerInfo find(Integer id) {
		return baseDaoImpl.find(ManagerInfo.class, id);
	}

	public ManagerInfo find(String name) {
		String sql = "from ManagerInfo as m where m.imName=?";
		String params[] = { name };
		return baseDaoImpl.find(sql, params);
	}

	public void save(Object entity) {
		baseDaoImpl.save(entity);
	}

	public List<ManagerInfo> findAll() {
		String sql = "from ManagerInfo";
		return baseDaoImpl.findAll(sql);
	}

	public void updata(Object entity) {

		baseDaoImpl.updata(entity);
	}

}
